package VN.EDU.IMIC.DEVELOPER.NGUYENTHUYOANH_LV1_02;

public class Models {

	
		 
	
	public float TinhToan(PhepToan objPhepToan)
	{
		float ketqua=0;
		switch (objPhepToan.PhepTinh)
		{
		case 1: ketqua=objPhepToan.getA()+objPhepToan.getB();break;
		case 2: ketqua=objPhepToan.getA()-objPhepToan.getB();break;
		
		case 3: ketqua= objPhepToan.getA()*objPhepToan.getB();break;
		case 4: 
		{
			if(objPhepToan.getB()!=0)
			{
			ketqua=objPhepToan.getA()/ objPhepToan.getB();
			
			}
			else
			{
				if(objPhepToan.getA()==0)
				{
					System.out.println("Ket qua cua phep tinh khong xac dinh");
					break;
				}
				else
				{
					System.out.println("Khong the chia cho 0");
					break;
				}
			
			}
		}
		
		}
		return ketqua;
		
	}
	
}
